package com.cn.dream_order_server.async;


import com.cn.dream_order_server.pojo.OrderOrder;
import com.cn.dream_order_server.service.OrderOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

@Service
public class WlcDoCreateOrderUtilAsync {

    @Autowired
    private OrderOrderService orderOrderService;

    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    public void doCreateOrderAsync(OrderOrder orderOrder){
        String s1 = stringRedisTemplate.opsForValue().get("create-order-" + orderOrder.getOrderId());
        if (s1!=null&&!"".equals(s1)){
            Integer integer = orderOrderService.doOrderCallOff(orderOrder);
            stringRedisTemplate.delete("create-order-"+orderOrder.getOrderId());
        }


    }
}
